gh-139103: Improve enum free-threaded scaling#144977
gh-139103: Improve enum free-threaded scaling#144977colesbury wants to merge 1 commit intopython:mainfrom
Conversation
Yhg1s
left a comment
There was a problem hiding this comment.
Didn't we talk about making module globals automatically use deferred refcounts before, and wouldn't that fix the majority of the uses of enum?
| contention on objects that are shared between multiple threads. | ||
| [clinic start generated code]*/ |
There was a problem hiding this comment.
This could do with a little bit of an explanation what effect this'll have on the object lifetime.
| _cls_type = None | ||
|
|
||
| def __init__(self, fget=None, fset=None, fdel=None, doc=None): | ||
| sys._enable_deferred_refcount(self) |
There was a problem hiding this comment.
This probably deserves a specific comment on why this matters.
|
I think @nascheme already made that change. Line 407 in 175ab31 It doesn't fix this issue because of how enum attributes are implemented. Maybe there's a way to extend that logic so that it covers the enum case? |
This is a draft PR showing how we can improve enum scaling. It requires enabling deferred reference counting on objects from Python. That will probably be split out into a separate PR and issue.